export enum MsgType {
  Text,
  File,
  Image,
  Video,
  Audio,
  System,
  History,
  ConversationList,
  Subscribe
}
export enum EventCode {
  // 接收
  // 服务器断开连接
  Disconnect,

  // 发送
  // 移除会话
  RemoveConversation,
  // 置顶会话
  TopConversation,
  // 取消置顶会话
  UnTopConversation
}

export interface Msg<T> {
  fromId: number
  toId: number
  type: number
  body: T
  createdAt: Date
}
export interface SubscribeBody {
  online: boolean
}

export interface TextBody {
  content: string
}
export interface FileBody {
  name: string
  url: string
}

export interface HistoryBody {
  count: number
  deadline: Date
  msgList: Msg<any>[]
}
export interface SystemBody {
  eventCode: EventCode
  event: string
}

export interface ConversationBody {
  count: number
  conversationList: Conversation<Msg<any>>[]
}

export interface Conversation<T> {
  userId: number
  type: number
  targetId: number
  latestMsg: Msg<T>
  unread: number
  top?: number
}
